﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WpfStudy
{
    /// <summary>
    /// Window2.xaml 的交互逻辑
    /// </summary>
    public partial class Window2 : Window
    {

        public static string WindowTitle = "山高月小";
        public static string ShowText { get { return "水落石出"; } }

        public Window2()
        {
            InitializeComponent();
            Loaded += Window2_Loaded;
        }

        private void Window2_Loaded(object sender, RoutedEventArgs e)
        {
            this.LB1.SelectedValuePath = "Age";
            this.LB1.DisplayMemberPath = "Name";
            this.LB1.ItemsSource = people;
        }

        List<Person> people = new List<Person>() {
            new Person(){ Age=1,Name="小明"},
            new Person(){Age=2,Name="荣耀王者"},
            new Person(){Age=3,Name="绿绿"},
        };



    }

    class Mybutton : Button
    {
        public Type UserWindowType { get; set; }

        protected override void OnClick()
        {
            base.OnClick();
            Window win = Activator.CreateInstance(UserWindowType) as Window;
            if (win != null)
            {
                win.ShowDialog();
            }
        }
    }
}
